package com.mypaper.elem;


public class TaskAttribute extends DataElement{
	/*
	 * 每个任务的信息，包括weightPrior及序号 
	 */
	public int index;
	public double weightPrior;
	
	public TaskAttribute(){
		index=0;
		weightPrior=0;
	}
	public TaskAttribute(int index, double bLevel){
		this.index=index;
		this.weightPrior=bLevel;
	}
	public TaskAttribute(TaskAttribute task){
		this.index=task.index;
		this.weightPrior=task.weightPrior;
	}
	public void setAttribute(int index, double bLevel){
		this.index=index;
		this.weightPrior=bLevel;
	}
	public int getIndex(){
		return index;
	}
	
	
	public double getBLevel(){
		return weightPrior;
	}
	public int compareTo(DataElement otherElement){
		TaskAttribute task=(TaskAttribute)otherElement;
		if(weightPrior>task.weightPrior)
			return 1;
		if(weightPrior<task.weightPrior)
			return -1;
		return 0;
	}
	public void makeCopy(DataElement otherElement){
		TaskAttribute task=(TaskAttribute)otherElement;
		index = task.index; 
		weightPrior = task.weightPrior;
	}
	
	public TaskAttribute getCopy(){
		TaskAttribute temp = new TaskAttribute(index, weightPrior);
		return temp;
	}
	public String toString(){
		return String.valueOf(index+": "+weightPrior);
	}
	
	public boolean equals(DataElement otherElement) {
		// TODO Auto-generated method stub
		if(this.index==((TaskAttribute)otherElement).index && this.weightPrior==((TaskAttribute)otherElement).getBLevel()){
			return true;
		}
		return false;
	}

	public DataElement properSlot(DataElement searchItem) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public boolean equalStart(float end) {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public boolean equalEnd(float start) {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public DataElement properSlotMoveTo(float start, float end, float weight) {
		// TODO Auto-generated method stub
		return null;
	}
}
